﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HotelProject.Account
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
        }

        protected void LoginAuthenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e)
        {
            MySQLDatabaseConnector msdc = new MySQLDatabaseConnector();

            string userName = LoginUser.UserName;
            string password = LoginUser.Password;

            bool result = msdc.Login(userName, password);

           
            if (result)
            {
                e.Authenticated = true;
            }
            else
            {
                e.Authenticated = false;
            }

        }
    }
}
